package router

import (
	"Im/api"
	_ "Im/docs"
	"github.com/gin-gonic/gin"
	swaggerfiles "github.com/swaggo/files"
	ginSwagger "github.com/swaggo/gin-swagger"
	"net/http"
)

func PublicRouter(r *gin.RouterGroup) {
	//swagger接口
	r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerfiles.Handler))
	//用户登录接口
	r.POST("/login", api.ImUserLogin)
	//设置静态资源路径
	r.StaticFS("/static", http.Dir("static"))
	//设置静态网页首页
	r.StaticFile("/", "./static/index.html")
	//配置网页图标
	r.StaticFile("/favicon.ico", "./static/favicon.ico")
	//注册用户的接口
	r.POST("/user/signup", api.ImUserSignUp)
	//发送邮箱验证码的路由
	r.POST("/send/code", api.SendCode)
	//ws接口
	r.GET("/msg", api.WebSocketMsg)
	//上传图片的接口
	r.POST("/uploadImg", api.UploadImg)
}
